package com.zx.controller;


import com.zx.service.IECommerceBalanceService;
import com.zx.vo.BalanceInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


// http://localhost:9001/account/balance/get-current-balance

@RestController
@RequestMapping("/balance")
public class BalanceController {

    @Autowired
    private IECommerceBalanceService balanceService;

    @GetMapping("/get-current-balance")
    public BalanceInfo getCurrentBalance(){
        return balanceService.getCurrentUserBalance();
    }

    @PostMapping("/deduct-balance")
    public BalanceInfo deductBalance(@RequestBody BalanceInfo balanceInfo){
        return balanceService.deductBalance(balanceInfo);
    }
}
